<?php
$con=mysqli_connect("localhost","root","root","gp23");
$username = $_GET["username"];
$password = $_GET["password"];
header("Access-Control-Allow-Origin:*");
$sql="SELECT * FROM `login` WHERE `username`='$username' AND `password`='$password'";
$res=mysqli_query($con , $sql);
if(!$res){
    die('{"type":"error", "msg" : "数据库错误" , "detail" : "'. mysqli_error($con) .'"}');
}
$arr = mysqli_fetch_all( $res, MYSQLI_ASSOC );

if( count($arr) >= 1 ){
    echo '{"type":"success", "msg" : "登陆成功成功"}';
}else{
    echo '{"type":"error", "msg" : "用户名或密码错误"}';
}
